package home.my.recordmanage.web;

import home.my.base.web.ModelAction;
import home.my.recordmanage.model.ErrorType;
import home.my.recordmanage.model.RecordSource;
import home.my.recordmanage.service.RecordSourceService;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import com.opensymphony.xwork2.Action;

public class RecordSourceAction extends ModelAction<RecordSource,RecordSourceService> {
	private Map<Long,Collection<ErrorType>> errorTypeMap = new HashMap<Long,Collection<ErrorType>>();
	
	public String makeDbSelect(){
		this.pojoList = this.getService().find("name", true);
		for(RecordSource source:pojoList){
			errorTypeMap.put(source.getId(),source.getErrorTypes());
			source.setErrorTypes(null);
		}
		return Action.SUCCESS;
	}

	public Map<Long, Collection<ErrorType>> getErrorTypeMap() {
		return errorTypeMap;
	}
	
}
